<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../../_template.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core">

    <ui:define name="centro">
       <h:form>
           <p:outputLabel value="Cadastro de Fornecedor PF - Consultar" style="font-size: x-large; margin-left: 25px" styleClass="labelInserir" />

            <p:fieldset styleClass="fieldsetInsert" style=" margin-left: 25px">

                <h:panelGrid columns="2" >
                    <h:panelGrid columns="1">
                        <p:outputLabel style="margin-right: 15px; text-align: left" value="Nome do fornecedor" for="nomeFornecedor" />
                        <p:inputText id="nomeFornecedor"  value="#{fornecedorBean.fornecedorPF.nome}" style="width: 600px;" disabled="true"/>
                    </h:panelGrid>

                    <h:panelGrid columns="1" style=" margin-left: 10px;">
                        <p:outputLabel style="text-align: left" value="CPF" for="cpf" />
                        <p:inputMask id="cpf"  mask="999.999.999-99" value="#{fornecedorBean.fornecedorPF.cpf}"
                                     required="true" requiredMessage="O campo 'CPF' deve ser preenchido!" disabled="true" >
                            <p:message for="cpf" />
                        </p:inputMask>

                    </h:panelGrid>
                </h:panelGrid>
                
                <h:panelGrid columns="3">
                    <h:panelGrid columns="1" >
                        <p:outputLabel style="text-align: left;" for="setor" value="Setor:" />
                        <p:selectOneMenu id="setor" value="#{fornecedorBean.fornecedorPF.setor}" style="width: 200px;" disabled="true">
                            <f:selectItem itemLabel="Selecione"/>
                            <f:selectItem itemLabel="INDÚSTRIA"   itemValue="INDUSTRIA"  />
                            <f:selectItem itemLabel="COMÉRCIO" itemValue="COMERCIO"/>
                            <f:selectItem itemLabel="SERVIÇOS"   itemValue="SERVIÇOS"  />
                        </p:selectOneMenu>
                    </h:panelGrid>
 
                    <h:panelGrid columns="1" style=" margin-left: 10px;" >
                        <p:outputLabel style="text-align: left;" for="anotacao" value="Anotação:" />
                        <p:inputText id="anotacao" value="#{fornecedorBean.fornecedorPF.anotacao}" style="width: 640px;" disabled="true" />
                    </h:panelGrid>
                </h:panelGrid>
                
                <h:panelGrid columns="1">
                    <h:panelGrid columns="1" >
                        <p:outputLabel style="text-align: left" value="Endereço" for="rua" />
                        <p:inputText id="rua"  value="#{fornecedorBean.fornecedorPF.endereco.rua}" style="width: 860px;" disabled="true" />
                    </h:panelGrid>
                </h:panelGrid>
                    
                <h:panelGrid columns="3" >
                    <h:panelGrid columns="1">
                        <p:outputLabel style="text-align: left" value="Cidade" for="cidade" />
                        <p:inputText id="cidade"  value="#{fornecedorBean.fornecedorPF.endereco.cidade}" style="width: 520px" disabled="true" />
                    </h:panelGrid>

                    <h:panelGrid columns="1" style=" margin-left: 10px;" >
                        <p:outputLabel style="text-align: left" value="UF" for="estado" />
                        <p:selectOneMenu id="estado" value="#{fornecedorBean.fornecedorPF.endereco.estado}" style="width: 65px" disabled="true">
                            <f:selectItem itemLabel=" "/>
                            <f:selectItems value="#{fornecedorBean.unidadesFederativas}" />
                        </p:selectOneMenu>
                    </h:panelGrid>
                    
                    <h:panelGrid columns="1" style=" margin-left: 10px;" >
                        <p:outputLabel style="text-align: left; " value="CEP" for="cep" />
                        <p:inputMask id="cep" mask="99.999-999" value="#{fornecedorBean.fornecedorPF.endereco.cep}" disabled="true" />
                    </h:panelGrid>
                </h:panelGrid>

                <h:panelGrid columns="2">
                    <h:panelGrid columns="1">
                        <p:outputLabel style="text-align: left" value="Telefone 1" for="tel1" />
                        <p:inputMask id="tel1" mask="(99)9999-9999" value="#{fornecedorBean.fornecedorPF.endereco.telefone1}" disabled="true" />
                    </h:panelGrid>
                    
                    <h:panelGrid columns="1" >
                        <p:outputLabel style="text-align: left" value="Telefone 2" for="tel2" />
                        <p:inputMask id="tel2" mask="(99)9999-9999" value="#{fornecedorBean.fornecedorPF.endereco.telefone2}" disabled="true" />
                    </h:panelGrid>
                </h:panelGrid>
                <br />                
                <p:commandButton value="Alterar" icon="ui-icon-check" action="incluirFornecedorPF" style="margin-left: 5px;" ajax="false" />
                <p:commandButton value="Excluir" icon="ui-icon-trash" action="#{fornecedorBean.removerFornecedorPF(fornecedorBean.fornecedorPF)}" 
                                 update="@all" style="margin-left: 10px">
                    <p:confirm header="Confirmação" message="Deseja realmente excluir a informação?" icon="ui-icon-alert" />
                    <p:confirmDialog global="true"  showEffect="fade" >
                        <p:commandButton value="Sim" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                        <p:commandButton value="Não" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
                    </p:confirmDialog>
                </p:commandButton>
                <p:commandButton value="Voltar" icon="ui-icon-arrowreturnthick-1-w" action="#{fornecedorBean.voltarParaFornecedor}" immediate="true"
                                 ajax="false" style="margin-left: 10px" />
            </p:fieldset>
        </h:form>
    </ui:define>

</ui:composition>
